﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using AutoUnzip.ViewModel;

namespace AutoUnzip.Converters
{
    [ValueConversion(typeof(State), typeof(Color))]
    public class StateValueColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var sv = (State)value;

            if (sv == State.None)
                return Brushes.LightYellow; 
            if (sv == State.Failed)
                return Brushes.IndianRed;
            if (sv == State.Success)
                return Brushes.LightGreen;

            return Colors.White;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}